package com.zhangwei.liwushuo.adapter.vh;

import android.content.Context;
import android.net.Uri;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.zhangwei.liwushuo.R;
import com.zhangwei.liwushuo.bean.DanPinEntity;
import com.zw.library.adapter.AAdapter;
import com.zw.library.view.ItemView;

import org.androidannotations.annotations.EViewGroup;
import org.androidannotations.annotations.ViewById;

/**
 * @说 明：
 * @项目名称：LiWuShuo
 * @包 名： com.zhangwei.liwushuo.adapter.vh
 * @类 名： DanPinItemView
 * @创 建人： zhangwei
 * @创建时间：2015-08-19 23:29
 * @版 本：v1.0
 * @修 改人：
 * @修改时间：
 * @修改备注：
 */
@EViewGroup(R.layout.item_danpin_layout)
public class DanPinItemView extends ItemView<DanPinEntity> {
    @ViewById
    SimpleDraweeView itemDanpinImg;
    @ViewById
    TextView itemDanpinPrice;
    @ViewById
    TextView itemDanpinLikes;
    @ViewById
    TextView itemDanpinName;

    public DanPinItemView(Context context) {
        super(context);
    }


    @Override
    public void bind(DanPinEntity item, AAdapter<DanPinEntity> adapter) {
        super.bind(item, adapter);
        itemDanpinImg.setImageURI(Uri.parse(item.getData().getCover_image_url()));
        itemDanpinName.setText(item.getData().getName());
        double fovNum = (double) item.getData().getFavorites_count() / (double)1000;
        itemDanpinLikes.setText(fovNum + "k");
        itemDanpinPrice.setText(item.getData().getPrice());
    }
}
